package ch5;

import java.util.*;

public class QueueDemo {
	public static void printQ(Queue queue) {
		while (queue.peek() != null)
			System.out.print(queue.remove() + " ");
		System.out.println();
	}
	public static void main(String[] args) {
		Queue queue = new PriorityQueue();
		Random rand = new Random(47);
		/*for (int i = 0; i < 10; i++) {
			queue.offer(rand.nextInt(i + 10));
			queue.offer(n);
		}*/
		queue.add(new Name("A","Z"));
		
		queue.add(new Name("B1","N"));
		queue.add(new Name("B2","N"));
		queue.add(new Name("B","M"));
		printQ(queue);
		System.out.println(queue);
		
		Queue qc = new LinkedList();
		for (char c : "Brontosaurus".toCharArray())
			qc.offer(c);
		printQ(qc);
	}
}
